package de.fuberlin.inf.alp3.ue09;

public class InCircleTest {
    public static void main(String[] args) {
        Node a = new Graph("a");
        a.add(new Graph("h"));
        a.add(new Graph("i"));
        Node b = new Graph("b");
        b.add(new Graph("k"));
        Node c = new Graph("c");
        c.add(new Graph("j"));
        Node d = new Graph("d");
        d.add(c);
        Node e = new Graph("e");
        e.add(d);
        Node f = new Graph("f");
        f.add(e);
        f.add(b);
        f.add(d);
        Node g = new Graph("g");
        g.add(a);
        g.add(b);
        g.add(c);
        test(a);
        test(g);
    }
    static void test(Node n) {
        System.out.println("Der Knoten " + ((Graph) n).name + " liegt" +
                ((InCircleTest.inCircle(n)) ? "" : " NICHT") + 
                " auf einem Kreis");
    }
    static boolean inCircle(Node n) {
        CircleSearch.initial = n;
        return new CircleSearch().act(n);
    }
}